import Vue from 'vue'
import Vuex from 'vuex'
import createLogger from 'vuex/dist/logger'
import * as actions from './actions'
import getters from './getters'

import app from './modules/app'
import user from './modules/user'
import weixin from './modules/weixin'
import permission from './modules/permission'
import { initStoreData } from './plugins'

import { debug } from '@/config/index'

import store from 'store'
import expirePlugin from 'store/plugins/expire'
// 本地存储
store.addPlugin(expirePlugin);

Vue.use(Vuex)

export default new Vuex.Store({
  actions,
  getters,
  modules: {
    app,
    user,
    permission,
    weixin
  },
  strict: debug,
  plugins: debug ? [createLogger(), initStoreData] : [initStoreData]
})
